#ifndef SCENE_H
#define SCENE_H

#include "rigidbodyengine.h"
#include "Bullet/bulletengine.h"
#include <Eigen/Core>
#include "resourcemanager.h"
class Scene
{


public:

    RigidBodyEngine *engine;
    Math::AABB aabb;

    RigidBody *selectedBody;

    RigidBody *ground;

    int timePhysics; // milliseconds

    ResourceManager *resourceManager;

    QString rootDir;

    Scene();

    ~Scene()
    {
        if(engine)
            delete(engine);
    }

    void simulate(void);

    void display(void) { ((BulletRigidBodyEngine*) engine)->displayCallback(); }

    void reshape(int w,int h) {((BulletRigidBodyEngine*) engine)->reshape(w,h);}

    RigidBody* createBox(Math::Vector3 &size, Math::Vector3 &position, Math::Quaternion &rotation);

    RigidBody* createSphere(Math::Real &radius, Math::Vector3 &position);

    RigidBody* createMesh(const QString &name, Math::Vector3 &position, Math::Quaternion &rotation);

    void addGround(void);

    void stop(void);

    void selectBody(int id);

    void save(void);

    void load(QString filename = "");

    void deleteScene(void);

    void removeSelectedBody(void);
};

#endif // SCENE_H
